try:
    import abc_decoder
except:
    import decoders.abc_decoder as abc_decoder

import pandas as pd
import numpy as np

def get_class():
    'None 表示这是抽象基类'
    return csv_decoder

class csv_decoder(abc_decoder.abs_decoder):
    def __init__(self):
        self.strFormat = 'csv'
    def get_name(self):
        return 'csv decoder'            
    def decode(self, file_path:str, **kwargs):
        
        try:
            column_keys = kwargs['column_keys']
        except:
            column_keys=['ax', 'ay', 'az']

        print('decoding %s file: %s' % (self.strFormat, file_path))
        df = pd.read_csv(file_path)
        df = df[column_keys]
        df.dropna()
        ret = np.array(df)
        return ret